
//
//  HWTopicsHouseTableViewCell.m
//  HappyWeekend
//
//  Created by 赵洁 on 16/1/12.
//  Copyright © 2016年 com.mjykj.www. All rights reserved.
//

#import "HWTopicsHouseTableViewCell.h"
#import "HWChannelsModel.h"
#define kgap  10  //jianju
@implementation HWTopicsHouseTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _titleLable = [[UILabel alloc]initWithFrame:CGRectMake(kgap, kgap, kgap*5, kgap*3)];
        _titleLable.font = [UIFont systemFontOfSize:15];
        _titleLable.text = @"宅家";
        [self.contentView addSubview:_titleLable];
        
        for (int i = 0; i < 4; i++) {
            UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
            button.frame = CGRectMake(kgap+i *(kScreenWidth/5+kgap*2),_titleLable.bottom+kgap ,kScreenWidth/5-kgap,kScreenWidth/5-kgap);
            button.layer.cornerRadius = (kScreenWidth/5)/2;
           // button.backgroundColor = [UIColor blackColor];
            button.tag = 10+i;
            UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake((kgap*2.5)+i*(kScreenWidth/5+kgap*2), button.bottom+kgap, 50, kgap*3)];
            lable.tag = 1000+i;
            //lable.backgroundColor = [UIColor grayColor];
            [self.contentView addSubview:lable];
            [self.contentView addSubview:button];
        }
        _DIYButton = [self.contentView viewWithTag:10];
        _cookButton= [self.contentView viewWithTag:11];
        _filmButton = [self.contentView viewWithTag:12];
        _mettingButton = [self.contentView viewWithTag:13];
        
    }
    return self;
}

- (void)setArray:(NSArray *)Array
{
    _Array = Array;
    for (int i = 0; i < 4; i++) {
        HWChannelsModel *model = Array[i];
        UIButton *but = [self.contentView viewWithTag:10+i];
        [but sd_setBackgroundImageWithURL:[NSURL URLWithString:model.icon_url] forState:(UIControlStateNormal)];
        UILabel *labe = [self.contentView viewWithTag:1000+i];
        labe.text = model.name;
    }
    

}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
